Drupal.behaviors.run_after_page_loads = function (context) {
	//bind to application search box
	$("#search-theme-form #edit-search-theme-form-1").autoSuggest(Drupal.settings.basePath +"suggest/a", 
		{
			minChars: 3, 
			matchCase: false,
			selectionLimit:0,
			queryParam:'k',
			retrieveLimit:10,
			keyDelay:400,
			selectedItemProp:'link',
			searchObjProps:'title',
			resultClick: function(data){ 
				$("#search-theme-form input").val(data.attributes.title);
				window.location = $(data.attributes.link).attr('href');
			}
		}
	)
	
	//bind to edit question
	$("#edit-question").autoSuggest(Drupal.settings.basePath +"suggest/q", 
		{
			minChars: 3, 
			matchCase: false,
			selectionLimit:0,
			queryParam:'k',
			retrieveLimit:10,
			keyDelay:400,
			selectedItemProp:'link',
			searchObjProps:'question',
			resultClick: function(data){ 
				$("##edit-question").val(data.attributes.title);
				window.location = $(data.attributes.link).attr('href');
			}
		}
	)	
}